package com.shop.admin.controller.Admin;

import com.shop.entity.dto.AdminBrands.*;
import com.shop.admin.service.BrandsService;
import com.shop.utils.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/brands")
public class AdminBrandsController {

    @Autowired
    private BrandsService brandsService;

    @PostMapping("save_wares_brands")
    public Result saveWaresBrands(@RequestBody AdminBrandsSaveDto dto){
        log.info("后台管理-添加商品分类");
        return brandsService.saveWaresBrands(dto);
    }

    @PostMapping("get_wares_brands_list")
    public Result getWaresBrandsList(@RequestBody AdminBrandsListDto dto){
        log.info("后台管理-商品分类列表");
        return brandsService.getWaresBrandsList(dto);
    }

    @PostMapping("update_get_wares_brands")
    public Result updateGetWaresBrands(@RequestBody AdminBrandsUpdateForGetDto dto){
        log.info("后台管理-商品分类修改回显");
        return brandsService.updateGetWaresBrands(dto);
    }

    @PostMapping("update_wares_brands")
    public Result updateWaresBrands(@RequestBody AdminBrandsUpdateDto dto){
        log.info("后台管理-修改商品分类");
        return brandsService.updateWaresBrands(dto);
    }

    @PostMapping("remove_wares_brands")
    public Result removeWaresBrands(@RequestBody AdminBrandsRemoveDto dto){
        log.info("后台管理-删除商品分类");
        return brandsService.removeWaresBrands(dto);
    }

    @PostMapping("open_brands")
    public Result openBrands(@RequestBody AdminBrandsOpenDto dto){
        log.info("后台管理-恢复分类");
        return brandsService.openBrands(dto);
    }

}
